package com.chen.controller;

import com.chen.service.IAccount;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
@RequestMapping("/accountA")
@Api(value = "微服务1，模拟银行1",tags = "账户管理")
public class AccountController {
    @Autowired
    private IAccount accountService;

    @PostMapping("/serviceOneTransOut")
    public boolean serviceOneTransOut(int accountId, BigDecimal amount) throws Exception {
        try {
            accountService.transOut(accountId,amount);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

}
